<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.3"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FabGL: SSD1306_OLED/128x64/NetworkTerminal/NetworkTerminal.ino</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">FabGL
   </div>
   <div id="projectbrief">ESP32 Display Controller and Graphics Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.3 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('_s_s_d1306__o_l_e_d_2128x64_2_network_terminal_2_network_terminal_8ino-example.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle"><div class="title">SSD1306_OLED/128x64/NetworkTerminal/NetworkTerminal.ino</div></div>
</div><!--header-->
<div class="contents">
<p >Network VT/ANSI Terminal</p>
<div class="fragment"><div class="line"><span class="comment">/*</span></div>
<div class="line"><span class="comment">  Created by Fabrizio Di Vittorio (fdivitto2013@gmail.com) - &lt;http://www.fabgl.com&gt;</span></div>
<div class="line"><span class="comment">  Copyright (c) 2019-2022 Fabrizio Di Vittorio.</span></div>
<div class="line"><span class="comment">  All rights reserved.</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">* Please contact fdivitto2013@gmail.com if you need a commercial license.</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">* This library and related software is available under GPL v3.</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">  FabGL is free software: you can redistribute it and/or modify</span></div>
<div class="line"><span class="comment">  it under the terms of the GNU General Public License as published by</span></div>
<div class="line"><span class="comment">  the Free Software Foundation, either version 3 of the License, or</span></div>
<div class="line"><span class="comment">  (at your option) any later version.</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">  FabGL is distributed in the hope that it will be useful,</span></div>
<div class="line"><span class="comment">  but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div>
<div class="line"><span class="comment">  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></div>
<div class="line"><span class="comment">  GNU General Public License for more details.</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">  You should have received a copy of the GNU General Public License</span></div>
<div class="line"><span class="comment">  along with FabGL.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"> <span class="comment">/*</span></div>
<div class="line"><span class="comment">  * OLED - SDA =&gt; GPIO 4</span></div>
<div class="line"><span class="comment">  * OLED - SCL =&gt; GPIO 15</span></div>
<div class="line"><span class="comment">  */</span></div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="fabgl_8h.html">fabgl.h</a>&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;WiFi.h&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="_i_c_m_p_8h.html">network/ICMP.h</a>&quot;</span></div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#define OLED_SDA       GPIO_NUM_4</span></div>
<div class="line"><span class="preprocessor">#define OLED_SCL       GPIO_NUM_15</span></div>
<div class="line"><span class="preprocessor">#define OLED_ADDR      0x3C</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// if your display hasn&#39;t RESET set to GPIO_UNUSED</span></div>
<div class="line"><span class="preprocessor">#define OLED_RESET     GPIO_UNUSED  </span><span class="comment">// ie Heltec has GPIO_NUM_16 for reset</span></div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">char</span> <span class="keyword">const</span> * AUTOEXEC = <span class="stringliteral">&quot;info\r&quot;</span>;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keyword">enum class</span> State { Prompt, PromptInput, UnknownCommand, Help, <a class="code hl_enumvalue" href="group___enumerations_gaae85628862e3db5a13e7c21a90589c1d.html#ggaae85628862e3db5a13e7c21a90589c1da4059b0251f66a18cb56f544728796875">Info</a>, Wifi, TelnetInit, Telnet, Scan, Ping, Reset };</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line">State        state = State::Prompt;</div>
<div class="line">WiFiClient   client;</div>
<div class="line"><span class="keywordtype">char</span> <span class="keyword">const</span> * currentScript = <span class="keyword">nullptr</span>;</div>
<div class="line"><span class="keywordtype">bool</span>         error = <span class="keyword">false</span>;</div>
<div class="line"> </div>
<div class="line"><a id="_a0" name="_a0"></a><a class="code hl_class" href="classfabgl_1_1_i2_c.html">fabgl::I2C</a>               <a class="code hl_enumvalue" href="group___enumerations_ga1e46218ee302fcc8c77e4ea0968ea149.html#gga1e46218ee302fcc8c77e4ea0968ea149afb87bf1fc88386ca21395991f90fff95">I2C</a>;</div>
<div class="line"><a id="_a1" name="_a1"></a><a class="code hl_class" href="classfabgl_1_1_s_s_d1306_controller.html">fabgl::SSD1306Controller</a> DisplayController;</div>
<div class="line"><a id="_a2" name="_a2"></a><a class="code hl_class" href="classfabgl_1_1_p_s2_controller.html">fabgl::PS2Controller</a>     PS2Controller;</div>
<div class="line"><a id="_a3" name="_a3"></a><a class="code hl_class" href="classfabgl_1_1_terminal.html">fabgl::Terminal</a>          Terminal;</div>
<div class="line"><a id="_a4" name="_a4"></a><a class="code hl_class" href="classfabgl_1_1_line_editor.html">fabgl::LineEditor</a>        LineEditor(&amp;Terminal);</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> clientWaitForChar()</div>
<div class="line">{</div>
<div class="line">  <span class="comment">// not so good...:-)</span></div>
<div class="line">  <span class="keywordflow">while</span> (!client.available())</div>
<div class="line">    ;</div>
<div class="line">  <span class="keywordflow">return</span> client.read();</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> termWaitForChar()</div>
<div class="line">{</div>
<div class="line">  <span class="keywordflow">while</span> (!Terminal.<a id="a5" name="a5"></a><a class="code hl_function" href="classfabgl_1_1_terminal_a4549a76725f2e4c013e4d57018366109.html#a4549a76725f2e4c013e4d57018366109">available</a>())</div>
<div class="line">    ;</div>
<div class="line">  <span class="keywordflow">return</span> Terminal.<a id="a6" name="a6"></a><a class="code hl_function" href="classfabgl_1_1_terminal_aaab5dab5b969a87f538242e524431637.html#aaab5dab5b969a87f538242e524431637">read</a>();</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> exe_info()</div>
<div class="line">{</div>
<div class="line">  Terminal.<a id="a7" name="a7"></a><a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;FabGL Terminal\r\n&quot;</span>);</div>
<div class="line">  Terminal.printf(<span class="stringliteral">&quot;Terminal Size: %dx%d\r\n&quot;</span>, Terminal.<a id="a8" name="a8"></a><a class="code hl_function" href="classfabgl_1_1_terminal_a6e9094a53fd8a44ad7a061abae461e5c.html#a6e9094a53fd8a44ad7a061abae461e5c">getColumns</a>(), Terminal.<a id="a9" name="a9"></a><a class="code hl_function" href="classfabgl_1_1_terminal_a1bb8ac2a73a5d9e6256505e1bf51c6a9.html#a1bb8ac2a73a5d9e6256505e1bf51c6a9">getRows</a>());</div>
<div class="line">  <span class="keywordflow">if</span> (!PS2Controller.<a id="a10" name="a10"></a><a class="code hl_function" href="classfabgl_1_1_p_s2_controller_a9e4c9b217d63aeaf19870e5f88c88d9e.html#a9e4c9b217d63aeaf19870e5f88c88d9e">keyboard</a>()-&gt;<a id="a11" name="a11"></a><a class="code hl_function" href="classfabgl_1_1_keyboard_aef1dd1399d92a09d1ed115911b563688.html#aef1dd1399d92a09d1ed115911b563688">isKeyboardAvailable</a>())</div>
<div class="line">    Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;Keyboard Error!!\r\n&quot;</span>);</div>
<div class="line">  Terminal.printf(<span class="stringliteral">&quot;Free Mem: %d\r\n&quot;</span>, heap_caps_get_free_size(0));</div>
<div class="line">  <span class="keywordflow">if</span> (WiFi.status() == WL_CONNECTED) {</div>
<div class="line">    Terminal.printf(<span class="stringliteral">&quot;WiFi SSID: %s\r\n&quot;</span>, WiFi.SSID().c_str());</div>
<div class="line">    Terminal.printf(<span class="stringliteral">&quot;IP: %s\r\n&quot;</span>, WiFi.localIP().toString().c_str());</div>
<div class="line">  }</div>
<div class="line">  Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;Type &#39;help&#39; for info\r\n&quot;</span>);</div>
<div class="line">  error = <span class="keyword">false</span>;</div>
<div class="line">  state = State::Prompt;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> exe_help()</div>
<div class="line">{</div>
<div class="line">  Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;info\r\n&quot;</span>);</div>
<div class="line">  Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;  Shows system info.\r\n\r\n&quot;</span>);</div>
<div class="line">  termWaitForChar();</div>
<div class="line">  Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;scan\r\n&quot;</span>);</div>
<div class="line">  Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;  Scan for WiFi networks.\r\n\r\n&quot;</span>);</div>
<div class="line">  termWaitForChar();</div>
<div class="line">  Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;wifi SSID PASSWORD\r\n&quot;</span>);</div>
<div class="line">  Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;  Connect to SSID using PASSWORD.\r\n\r\n&quot;</span>);</div>
<div class="line">  termWaitForChar();</div>
<div class="line">  Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;telnet HOST [PORT]\r\n&quot;</span>);</div>
<div class="line">  Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;  Open telnet session with HOST (IP or host name) using PORT.\r\n\r\n&quot;</span>);</div>
<div class="line">  termWaitForChar();</div>
<div class="line">  Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;reboot\r\n&quot;</span>);</div>
<div class="line">  Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;  Restart the system.\r\n\r\n&quot;</span>);</div>
<div class="line">  error = <span class="keyword">false</span>;</div>
<div class="line">  state = State::Prompt;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> decode_command()</div>
<div class="line">{</div>
<div class="line">  <span class="keyword">auto</span> inputLine = LineEditor.get();</div>
<div class="line">  <span class="keywordflow">if</span> (*inputLine == 0)</div>
<div class="line">    state = State::Prompt;</div>
<div class="line">  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strncmp(inputLine, <span class="stringliteral">&quot;help&quot;</span>, 4) == 0)</div>
<div class="line">    state = State::Help;</div>
<div class="line">  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strncmp(inputLine, <span class="stringliteral">&quot;info&quot;</span>, 4) == 0)</div>
<div class="line">    state = State::Info;</div>
<div class="line">  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strncmp(inputLine, <span class="stringliteral">&quot;wifi&quot;</span>, 4) == 0)</div>
<div class="line">    state = State::Wifi;</div>
<div class="line">  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strncmp(inputLine, <span class="stringliteral">&quot;telnet&quot;</span>, 6) == 0)</div>
<div class="line">    state = State::TelnetInit;</div>
<div class="line">  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strncmp(inputLine, <span class="stringliteral">&quot;scan&quot;</span>, 4) == 0)</div>
<div class="line">    state = State::Scan;</div>
<div class="line">  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strncmp(inputLine, <span class="stringliteral">&quot;ping&quot;</span>, 4) == 0)</div>
<div class="line">    state = State::Ping;</div>
<div class="line">  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strncmp(inputLine, <span class="stringliteral">&quot;reboot&quot;</span>, 4) == 0)</div>
<div class="line">    state = State::Reset;</div>
<div class="line">  <span class="keywordflow">else</span></div>
<div class="line">    state = State::UnknownCommand;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> exe_prompt()</div>
<div class="line">{</div>
<div class="line">  <span class="keywordflow">if</span> (currentScript) {</div>
<div class="line">    <span class="comment">// process commands from script</span></div>
<div class="line">    <span class="keywordflow">if</span> (*currentScript == 0 || error) {</div>
<div class="line">      <span class="comment">// end of script, return to prompt</span></div>
<div class="line">      currentScript = <span class="keyword">nullptr</span>;</div>
<div class="line">      state = State::Prompt;</div>
<div class="line">    } <span class="keywordflow">else</span> {</div>
<div class="line">      <span class="comment">// execute current line and move to the next one</span></div>
<div class="line">      <span class="keywordtype">int</span> linelen = strchr(currentScript, <span class="charliteral">&#39;\r&#39;</span>) - currentScript;</div>
<div class="line">      LineEditor.setText(currentScript, linelen);</div>
<div class="line">      currentScript += linelen + 1;</div>
<div class="line">      decode_command();</div>
<div class="line">    }</div>
<div class="line">  } <span class="keywordflow">else</span> {</div>
<div class="line">    <span class="comment">// process commands from keyboard</span></div>
<div class="line">    Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;&gt;&quot;</span>);</div>
<div class="line">    state = State::PromptInput;</div>
<div class="line">  }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> exe_promptInput()</div>
<div class="line">{</div>
<div class="line">  LineEditor.setText(<span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line">  LineEditor.edit();</div>
<div class="line">  decode_command();</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> exe_scan()</div>
<div class="line">{</div>
<div class="line">  <span class="keyword">static</span> <span class="keywordtype">char</span> <span class="keyword">const</span> * ENC2STR[] = { <span class="stringliteral">&quot;Open&quot;</span>, <span class="stringliteral">&quot;WEP&quot;</span>, <span class="stringliteral">&quot;WPA-PSK&quot;</span>, <span class="stringliteral">&quot;WPA2-PSK&quot;</span>, <span class="stringliteral">&quot;WPA/WPA2-PSK&quot;</span>, <span class="stringliteral">&quot;WPA-ENTERPRISE&quot;</span> };</div>
<div class="line">  Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;Scanning...\r\n&quot;</span>);</div>
<div class="line">  Terminal.<a id="a12" name="a12"></a><a class="code hl_function" href="classfabgl_1_1_terminal_af04a513134593e61c4575b266c8bf0ee.html#af04a513134593e61c4575b266c8bf0ee">flush</a>();</div>
<div class="line">  <span class="keywordtype">int</span> networksCount = WiFi.scanNetworks();</div>
<div class="line">  Terminal.printf(<span class="stringliteral">&quot;%d network(s)\r\n&quot;</span>, networksCount);</div>
<div class="line">  <span class="keywordflow">if</span> (networksCount) {</div>
<div class="line">    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; networksCount; ++i)</div>
<div class="line">      Terminal.printf(<span class="stringliteral">&quot;#%d %s %ddBm ch%d %s\r\n&quot;</span>, i + 1, WiFi.SSID(i).c_str(), WiFi.RSSI(i), WiFi.channel(i), ENC2STR[WiFi.encryptionType(i)]);</div>
<div class="line">  }</div>
<div class="line">  WiFi.scanDelete();</div>
<div class="line">  error = <span class="keyword">false</span>;</div>
<div class="line">  state = State::Prompt;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> exe_wifi()</div>
<div class="line">{</div>
<div class="line">  <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> MAX_SSID_SIZE = 32;</div>
<div class="line">  <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> MAX_PSW_SIZE  = 32;</div>
<div class="line">  <span class="keywordtype">char</span> ssid[MAX_SSID_SIZE + 1];</div>
<div class="line">  <span class="keywordtype">char</span> psw[MAX_PSW_SIZE + 1] = {0};</div>
<div class="line">  error = <span class="keyword">true</span>;</div>
<div class="line">  <span class="keyword">auto</span> inputLine = LineEditor.get();</div>
<div class="line">  <span class="keywordflow">if</span> (sscanf(inputLine, <span class="stringliteral">&quot;wifi %32s %32s&quot;</span>, ssid, psw) &gt;= 1) {</div>
<div class="line">    Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;Connecting WiFi...&quot;</span>);</div>
<div class="line">    Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_af04a513134593e61c4575b266c8bf0ee.html#af04a513134593e61c4575b266c8bf0ee">flush</a>();</div>
<div class="line">    WiFi.disconnect(<span class="keyword">true</span>, <span class="keyword">true</span>);</div>
<div class="line">    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 2; ++i) {</div>
<div class="line">      WiFi.begin(ssid, psw);</div>
<div class="line">      <span class="keywordflow">if</span> (WiFi.waitForConnectResult() == WL_CONNECTED)</div>
<div class="line">        <span class="keywordflow">break</span>;</div>
<div class="line">      WiFi.disconnect(<span class="keyword">true</span>, <span class="keyword">true</span>);</div>
<div class="line">    }</div>
<div class="line">    <span class="keywordflow">if</span> (WiFi.status() == WL_CONNECTED) {</div>
<div class="line">      Terminal.printf(<span class="stringliteral">&quot;SSID: %s\r\nIP: %s\r\n&quot;</span>, WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());</div>
<div class="line">      error = <span class="keyword">false</span>;</div>
<div class="line">    } <span class="keywordflow">else</span> {</div>
<div class="line">      Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;failed!\r\n&quot;</span>);</div>
<div class="line">    }</div>
<div class="line">  }</div>
<div class="line">  state = State::Prompt;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> exe_telnetInit()</div>
<div class="line">{</div>
<div class="line">  <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> MAX_HOST_SIZE = 32;</div>
<div class="line">  <span class="keywordtype">char</span> host[MAX_HOST_SIZE + 1];</div>
<div class="line">  <span class="keywordtype">int</span> port;</div>
<div class="line">  error = <span class="keyword">true</span>;</div>
<div class="line">  <span class="keyword">auto</span> inputLine = LineEditor.get();</div>
<div class="line">  <span class="keywordtype">int</span> pCount = sscanf(inputLine, <span class="stringliteral">&quot;telnet %32s %d&quot;</span>, host, &amp;port);</div>
<div class="line">  <span class="keywordflow">if</span> (pCount &gt; 0) {</div>
<div class="line">    <span class="keywordflow">if</span> (pCount == 1)</div>
<div class="line">      port = 23;</div>
<div class="line">    Terminal.printf(<span class="stringliteral">&quot;Trying %s...\r\n&quot;</span>, host);</div>
<div class="line">    <span class="keywordflow">if</span> (client.connect(host, port)) {</div>
<div class="line">      Terminal.printf(<span class="stringliteral">&quot;Connected to %s\r\n&quot;</span>, host);</div>
<div class="line">      error = <span class="keyword">false</span>;</div>
<div class="line">      state = State::Telnet;</div>
<div class="line">    } <span class="keywordflow">else</span> {</div>
<div class="line">      Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;Unable to connect to remote host\r\n&quot;</span>);</div>
<div class="line">      state = State::Prompt;</div>
<div class="line">    }</div>
<div class="line">  } <span class="keywordflow">else</span> {</div>
<div class="line">    Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;Mistake\r\n&quot;</span>);</div>
<div class="line">    state = State::Prompt;</div>
<div class="line">  }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> exe_telnet()</div>
<div class="line">{</div>
<div class="line">  <span class="comment">// process data from remote host (up to 1024 codes at the time)</span></div>
<div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; client.available() &amp;&amp; i &lt; 1024; ++i) {</div>
<div class="line">    <span class="keywordtype">int</span> c = client.read();</div>
<div class="line">    <span class="keywordflow">if</span> (c == 0xFF) {</div>
<div class="line">      <span class="comment">// IAC (Interpret As Command)</span></div>
<div class="line">      uint8_t cmd = clientWaitForChar();</div>
<div class="line">      uint8_t opt = clientWaitForChar();</div>
<div class="line">      <span class="keywordflow">if</span> (cmd == 0xFD &amp;&amp; opt == 0x1F) {</div>
<div class="line">        <span class="comment">// DO WINDOWSIZE</span></div>
<div class="line">        client.write(<span class="stringliteral">&quot;\xFF\xFB\x1F&quot;</span>, 3); <span class="comment">// IAC WILL WINDOWSIZE</span></div>
<div class="line">        client.write(<span class="stringliteral">&quot;\xFF\xFA\x1F&quot;</span> <span class="stringliteral">&quot;\x00\x50\x00\x19&quot;</span> <span class="stringliteral">&quot;\xFF\xF0&quot;</span>, 9);  <span class="comment">// IAC SB WINDOWSIZE 0 80 0 25 IAC SE</span></div>
<div class="line">      } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cmd == 0xFD &amp;&amp; opt == 0x18) {</div>
<div class="line">        <span class="comment">// DO TERMINALTYPE</span></div>
<div class="line">        client.write(<span class="stringliteral">&quot;\xFF\xFB\x18&quot;</span>, 3); <span class="comment">// IAC WILL TERMINALTYPE</span></div>
<div class="line">      } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cmd == 0xFA &amp;&amp; opt == 0x18) {</div>
<div class="line">        <span class="comment">// SB TERMINALTYPE</span></div>
<div class="line">        c = clientWaitForChar();  <span class="comment">// bypass &#39;1&#39;</span></div>
<div class="line">        c = clientWaitForChar();  <span class="comment">// bypass IAC</span></div>
<div class="line">        c = clientWaitForChar();  <span class="comment">// bypass SE</span></div>
<div class="line">        client.write(<span class="stringliteral">&quot;\xFF\xFA\x18\x00&quot;</span> <span class="stringliteral">&quot;wsvt25&quot;</span> <span class="stringliteral">&quot;\xFF\xF0&quot;</span>, 12); <span class="comment">// IAC SB TERMINALTYPE 0 &quot;....&quot; IAC SE</span></div>
<div class="line">      } <span class="keywordflow">else</span> {</div>
<div class="line">        uint8_t pck[3] = {0xFF, 0, opt};</div>
<div class="line">        <span class="keywordflow">if</span> (cmd == 0xFD)  <span class="comment">// DO -&gt; WONT</span></div>
<div class="line">          pck[1] = 0xFC;</div>
<div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cmd == 0xFB) <span class="comment">// WILL -&gt; DO</span></div>
<div class="line">          pck[1] = 0xFD;</div>
<div class="line">        client.write(pck, 3);</div>
<div class="line">      }</div>
<div class="line">    } <span class="keywordflow">else</span> {</div>
<div class="line">      Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(c);</div>
<div class="line">    }</div>
<div class="line">  }</div>
<div class="line">  <span class="comment">// process data from terminal (keyboard)</span></div>
<div class="line">  <span class="keywordflow">while</span> (Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a4549a76725f2e4c013e4d57018366109.html#a4549a76725f2e4c013e4d57018366109">available</a>()) {</div>
<div class="line">    client.write( Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_aaab5dab5b969a87f538242e524431637.html#aaab5dab5b969a87f538242e524431637">read</a>() );</div>
<div class="line">  }</div>
<div class="line">  <span class="comment">// return to prompt?</span></div>
<div class="line">  <span class="keywordflow">if</span> (!client.connected()) {</div>
<div class="line">    client.stop();</div>
<div class="line">    state = State::Prompt;</div>
<div class="line">  }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> exe_ping()</div>
<div class="line">{</div>
<div class="line">  <span class="keywordtype">char</span> host[64];</div>
<div class="line">  <span class="keyword">auto</span> inputLine = LineEditor.get();</div>
<div class="line">  <span class="keywordtype">int</span> pcount = sscanf(inputLine, <span class="stringliteral">&quot;ping %s&quot;</span>, host);</div>
<div class="line">  <span class="keywordflow">if</span> (pcount &gt; 0) {</div>
<div class="line">    <span class="keywordtype">int</span> sent = 0, recv = 0;</div>
<div class="line">    <a id="_a13" name="_a13"></a><a class="code hl_class" href="classfabgl_1_1_i_c_m_p.html">fabgl::ICMP</a> icmp;</div>
<div class="line">    <span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div>
<div class="line"> </div>
<div class="line">      <span class="comment">// CTRL-C ?</span></div>
<div class="line">      <span class="keywordflow">if</span> (Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a4549a76725f2e4c013e4d57018366109.html#a4549a76725f2e4c013e4d57018366109">available</a>() &amp;&amp; Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_aaab5dab5b969a87f538242e524431637.html#aaab5dab5b969a87f538242e524431637">read</a>() == 0x03)</div>
<div class="line">        <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line">      <span class="keywordtype">int</span> t = icmp.<a id="a14" name="a14"></a>ping(host);</div>
<div class="line">      <span class="keywordflow">if</span> (t &gt;= 0) {</div>
<div class="line">        Terminal.printf(<span class="stringliteral">&quot;%s %d %dms\r\n&quot;</span>, icmp.<a id="a15" name="a15"></a>hostIP().toString().c_str(), icmp.<a id="a16" name="a16"></a>receivedSeq(), (<span class="keywordtype">int</span>)((<span class="keywordtype">double</span>)t/1000.0));</div>
<div class="line">        delay(1000);</div>
<div class="line">        ++recv;</div>
<div class="line">      } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (t == -2) {</div>
<div class="line">        Terminal.printf(<span class="stringliteral">&quot;Cannot resolve %s: Unknown host\r\n&quot;</span>, host);</div>
<div class="line">        <span class="keywordflow">break</span>;</div>
<div class="line">      } <span class="keywordflow">else</span> {</div>
<div class="line">        Terminal.printf(<span class="stringliteral">&quot;Timeout s=%d\r\n&quot;</span>, icmp.receivedSeq());</div>
<div class="line">      }</div>
<div class="line">      ++sent;</div>
<div class="line"> </div>
<div class="line">    }</div>
<div class="line">    <span class="keywordflow">if</span> (sent &gt; 0) {</div>
<div class="line">      Terminal.printf(<span class="stringliteral">&quot;--- %s ping statistics ---\r\n&quot;</span>, host);</div>
<div class="line">      Terminal.printf(<span class="stringliteral">&quot;%d packets transmitted, %d packets received, %.1f%% packet loss\r\n&quot;</span>, sent, recv, (<span class="keywordtype">double</span>)(sent - recv) / sent * 100.0);</div>
<div class="line">    }</div>
<div class="line">  }</div>
<div class="line">  state = State::Prompt;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> setup()</div>
<div class="line">{</div>
<div class="line">  <span class="comment">//Serial.begin(115200); // DEBUG ONLY</span></div>
<div class="line"> </div>
<div class="line">  PS2Controller.<a id="a17" name="a17"></a><a class="code hl_function" href="classfabgl_1_1_p_s2_controller_ab8520612804a921ad834b41214a99c09.html#ab8520612804a921ad834b41214a99c09">begin</a>(PS2Preset::KeyboardPort0);</div>
<div class="line"> </div>
<div class="line">  <a class="code hl_enumvalue" href="group___enumerations_ga1e46218ee302fcc8c77e4ea0968ea149.html#gga1e46218ee302fcc8c77e4ea0968ea149afb87bf1fc88386ca21395991f90fff95">I2C</a>.begin(OLED_SDA, OLED_SCL);</div>
<div class="line"> </div>
<div class="line">  DisplayController.<a id="a18" name="a18"></a><a class="code hl_function" href="classfabgl_1_1_s_s_d1306_controller_af4457c33ec3247fb92c8bf2a2d8e9819.html#af4457c33ec3247fb92c8bf2a2d8e9819">begin</a>(&amp;I2C, OLED_ADDR, OLED_RESET);</div>
<div class="line">  DisplayController.<a id="a19" name="a19"></a><a class="code hl_function" href="classfabgl_1_1_s_s_d1306_controller_a2ac60f74ade23bfba42ef0985635589d.html#a2ac60f74ade23bfba42ef0985635589d">setResolution</a>(<a id="a20" name="a20"></a><a class="code hl_define" href="fabglconf_8h_a48a7b2c95a1f0546c72310844fa6fc74.html#a48a7b2c95a1f0546c72310844fa6fc74">OLED_128x64</a>);</div>
<div class="line"> </div>
<div class="line">  Terminal.<a id="a21" name="a21"></a><a class="code hl_function" href="classfabgl_1_1_terminal_aebaecc1fa474fddc48dd5778024b19a5.html#aebaecc1fa474fddc48dd5778024b19a5">begin</a>(&amp;DisplayController);</div>
<div class="line">  Terminal.<a id="a22" name="a22"></a><a class="code hl_function" href="classfabgl_1_1_terminal_a068123b964647130439aa949370181dc.html#a068123b964647130439aa949370181dc">connectLocally</a>();      <span class="comment">// to use Terminal.read(), available(), etc..</span></div>
<div class="line">  <span class="comment">//Terminal.setLogStream(Serial);  // DEBUG ONLY</span></div>
<div class="line"> </div>
<div class="line">  Terminal.<a id="a23" name="a23"></a><a class="code hl_function" href="classfabgl_1_1_terminal_ae6f04360ccc33a519bdff509fd81df62.html#ae6f04360ccc33a519bdff509fd81df62">setBackgroundColor</a>(<a id="a24" name="a24"></a><a class="code hl_enumvalue" href="group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#ggab87bacfdad76e61b9412d7124be44c1cac1e9bce8242f443c54c7405223d616cd">Color::Black</a>);</div>
<div class="line">  Terminal.<a id="a25" name="a25"></a><a class="code hl_function" href="classfabgl_1_1_terminal_afad23f091c4bb07a71963f5f7aa1831d.html#afad23f091c4bb07a71963f5f7aa1831d">setForegroundColor</a>(<a id="a26" name="a26"></a><a class="code hl_enumvalue" href="group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#ggab87bacfdad76e61b9412d7124be44c1ca8e551a5ca49dca47dd8d5af7a04dd9ea">Color::BrightGreen</a>);</div>
<div class="line">  Terminal.<a id="a27" name="a27"></a><a class="code hl_function" href="classfabgl_1_1_terminal_a72770033c3a06f499a251909efba87c7.html#a72770033c3a06f499a251909efba87c7">loadFont</a>(&amp;fabgl::FONT_6x8);</div>
<div class="line">  Terminal.<a id="a28" name="a28"></a><a class="code hl_function" href="classfabgl_1_1_terminal_a2da678d7453efcfed190b99ac93a53d0.html#a2da678d7453efcfed190b99ac93a53d0">clear</a>();</div>
<div class="line"> </div>
<div class="line">  Terminal.<a id="a29" name="a29"></a><a class="code hl_function" href="classfabgl_1_1_terminal_aace245bfe6cab7b4339bd691077e1c23.html#aace245bfe6cab7b4339bd691077e1c23">enableCursor</a>(<span class="keyword">true</span>);</div>
<div class="line"> </div>
<div class="line">  currentScript = AUTOEXEC;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> loop()</div>
<div class="line">{</div>
<div class="line">  <span class="keywordflow">switch</span> (state) {</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">case</span> State::Prompt:</div>
<div class="line">      exe_prompt();</div>
<div class="line">      <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">case</span> State::PromptInput:</div>
<div class="line">      exe_promptInput();</div>
<div class="line">      <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">case</span> State::Help:</div>
<div class="line">      exe_help();</div>
<div class="line">      <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">case</span> State::Info:</div>
<div class="line">      exe_info();</div>
<div class="line">      <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">case</span> State::Wifi:</div>
<div class="line">      exe_wifi();</div>
<div class="line">      <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">case</span> State::TelnetInit:</div>
<div class="line">      exe_telnetInit();</div>
<div class="line">      <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">case</span> State::Telnet:</div>
<div class="line">      exe_telnet();</div>
<div class="line">      <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">case</span> State::Scan:</div>
<div class="line">      exe_scan();</div>
<div class="line">      <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">case</span> State::Ping:</div>
<div class="line">      exe_ping();</div>
<div class="line">      <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">case</span> State::Reset:</div>
<div class="line">      ESP.restart();</div>
<div class="line">      <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">case</span> State::UnknownCommand:</div>
<div class="line">      Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;\r\nMistake\r\n&quot;</span>);</div>
<div class="line">      state = State::Prompt;</div>
<div class="line">      <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">default</span>:</div>
<div class="line">      Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>(<span class="stringliteral">&quot;\r\nNot Implemeted\r\n&quot;</span>);</div>
<div class="line">      state = State::Prompt;</div>
<div class="line">      <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line">  }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="ttc" id="a_i_c_m_p_8h_html"><div class="ttname"><a href="_i_c_m_p_8h.html">ICMP.h</a></div><div class="ttdoc">This file contains ICMP (ping) class.</div></div>
<div class="ttc" id="aclassfabgl_1_1_i2_c_html"><div class="ttname"><a href="classfabgl_1_1_i2_c.html">fabgl::I2C</a></div><div class="ttdoc">I2C class allows multiple tasks to communicate with I2C devices, serializing read/write jobs.</div><div class="ttdef"><b>Definition:</b> <a href="tsi2c_8h_source.html#l00094">tsi2c.h:94</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_i_c_m_p_html"><div class="ttname"><a href="classfabgl_1_1_i_c_m_p.html">fabgl::ICMP</a></div><div class="ttdoc">ICMP Implementation.</div><div class="ttdef"><b>Definition:</b> <a href="_i_c_m_p_8h_source.html#l00087">ICMP.h:87</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_keyboard_aef1dd1399d92a09d1ed115911b563688_html_aef1dd1399d92a09d1ed115911b563688"><div class="ttname"><a href="classfabgl_1_1_keyboard_aef1dd1399d92a09d1ed115911b563688.html#aef1dd1399d92a09d1ed115911b563688">fabgl::Keyboard::isKeyboardAvailable</a></div><div class="ttdeci">bool isKeyboardAvailable()</div><div class="ttdoc">Checks if keyboard has been detected and correctly initialized.</div><div class="ttdef"><b>Definition:</b> <a href="keyboard_8h_source.html#l00165">keyboard.h:165</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_line_editor_html"><div class="ttname"><a href="classfabgl_1_1_line_editor.html">fabgl::LineEditor</a></div><div class="ttdoc">LineEditor is a single-line / multiple-rows editor which uses the Terminal object as input and output...</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8h_source.html#l01862">terminal.h:1862</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_p_s2_controller_a9e4c9b217d63aeaf19870e5f88c88d9e_html_a9e4c9b217d63aeaf19870e5f88c88d9e"><div class="ttname"><a href="classfabgl_1_1_p_s2_controller_a9e4c9b217d63aeaf19870e5f88c88d9e.html#a9e4c9b217d63aeaf19870e5f88c88d9e">fabgl::PS2Controller::keyboard</a></div><div class="ttdeci">static Keyboard * keyboard()</div><div class="ttdoc">Returns the instance of Keyboard object automatically created by PS2Controller.</div><div class="ttdef"><b>Definition:</b> <a href="ps2controller_8h_source.html#l00179">ps2controller.h:179</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_p_s2_controller_ab8520612804a921ad834b41214a99c09_html_ab8520612804a921ad834b41214a99c09"><div class="ttname"><a href="classfabgl_1_1_p_s2_controller_ab8520612804a921ad834b41214a99c09.html#ab8520612804a921ad834b41214a99c09">fabgl::PS2Controller::begin</a></div><div class="ttdeci">static void begin(gpio_num_t port0_clkGPIO, gpio_num_t port0_datGPIO, gpio_num_t port1_clkGPIO=GPIO_UNUSED, gpio_num_t port1_datGPIO=GPIO_UNUSED)</div><div class="ttdoc">Initializes PS2 device controller.</div><div class="ttdef"><b>Definition:</b> <a href="ps2controller_8cpp_source.html#l01115">ps2controller.cpp:1115</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_p_s2_controller_html"><div class="ttname"><a href="classfabgl_1_1_p_s2_controller.html">fabgl::PS2Controller</a></div><div class="ttdoc">The PS2 device controller class.</div><div class="ttdef"><b>Definition:</b> <a href="ps2controller_8h_source.html#l00082">ps2controller.h:82</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_s_s_d1306_controller_a2ac60f74ade23bfba42ef0985635589d_html_a2ac60f74ade23bfba42ef0985635589d"><div class="ttname"><a href="classfabgl_1_1_s_s_d1306_controller_a2ac60f74ade23bfba42ef0985635589d.html#a2ac60f74ade23bfba42ef0985635589d">fabgl::SSD1306Controller::setResolution</a></div><div class="ttdeci">void setResolution(char const *modeline, int viewPortWidth=-1, int viewPortHeight=-1, bool doubleBuffered=false)</div><div class="ttdoc">Sets SSD1306 resolution and viewport size.</div><div class="ttdef"><b>Definition:</b> <a href="_s_s_d1306_controller_8cpp_source.html#l00166">SSD1306Controller.cpp:166</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_s_s_d1306_controller_af4457c33ec3247fb92c8bf2a2d8e9819_html_af4457c33ec3247fb92c8bf2a2d8e9819"><div class="ttname"><a href="classfabgl_1_1_s_s_d1306_controller_af4457c33ec3247fb92c8bf2a2d8e9819.html#af4457c33ec3247fb92c8bf2a2d8e9819">fabgl::SSD1306Controller::begin</a></div><div class="ttdeci">void begin(I2C *i2c, int address=0x3C, gpio_num_t resetGPIO=GPIO_UNUSED)</div><div class="ttdoc">Initializes SSD1306 assigning I2C bus, reset pin and address.</div><div class="ttdef"><b>Definition:</b> <a href="_s_s_d1306_controller_8cpp_source.html#l00138">SSD1306Controller.cpp:138</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_s_s_d1306_controller_html"><div class="ttname"><a href="classfabgl_1_1_s_s_d1306_controller.html">fabgl::SSD1306Controller</a></div><div class="ttdoc">Display driver for SSD1306 based OLED display, with I2C connection.</div><div class="ttdef"><b>Definition:</b> <a href="_s_s_d1306_controller_8h_source.html#l00092">SSD1306Controller.h:92</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_a068123b964647130439aa949370181dc_html_a068123b964647130439aa949370181dc"><div class="ttname"><a href="classfabgl_1_1_terminal_a068123b964647130439aa949370181dc.html#a068123b964647130439aa949370181dc">fabgl::Terminal::connectLocally</a></div><div class="ttdeci">void connectLocally()</div><div class="ttdoc">Permits using of terminal locally.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l00439">terminal.cpp:439</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_a1bb8ac2a73a5d9e6256505e1bf51c6a9_html_a1bb8ac2a73a5d9e6256505e1bf51c6a9"><div class="ttname"><a href="classfabgl_1_1_terminal_a1bb8ac2a73a5d9e6256505e1bf51c6a9.html#a1bb8ac2a73a5d9e6256505e1bf51c6a9">fabgl::Terminal::getRows</a></div><div class="ttdeci">int getRows()</div><div class="ttdoc">Returns the number of lines.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8h_source.html#l01077">terminal.h:1077</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_a2da678d7453efcfed190b99ac93a53d0_html_a2da678d7453efcfed190b99ac93a53d0"><div class="ttname"><a href="classfabgl_1_1_terminal_a2da678d7453efcfed190b99ac93a53d0.html#a2da678d7453efcfed190b99ac93a53d0">fabgl::Terminal::clear</a></div><div class="ttdeci">void clear(bool moveCursor=true)</div><div class="ttdoc">Clears the screen.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l00797">terminal.cpp:797</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_a4549a76725f2e4c013e4d57018366109_html_a4549a76725f2e4c013e4d57018366109"><div class="ttname"><a href="classfabgl_1_1_terminal_a4549a76725f2e4c013e4d57018366109.html#a4549a76725f2e4c013e4d57018366109">fabgl::Terminal::available</a></div><div class="ttdeci">int available()</div><div class="ttdoc">Gets the number of codes available in the keyboard queue.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l01484">terminal.cpp:1484</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_a6e9094a53fd8a44ad7a061abae461e5c_html_a6e9094a53fd8a44ad7a061abae461e5c"><div class="ttname"><a href="classfabgl_1_1_terminal_a6e9094a53fd8a44ad7a061abae461e5c.html#a6e9094a53fd8a44ad7a061abae461e5c">fabgl::Terminal::getColumns</a></div><div class="ttdeci">int getColumns()</div><div class="ttdoc">Returns the number of columns.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8h_source.html#l01070">terminal.h:1070</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_a72770033c3a06f499a251909efba87c7_html_a72770033c3a06f499a251909efba87c7"><div class="ttname"><a href="classfabgl_1_1_terminal_a72770033c3a06f499a251909efba87c7.html#a72770033c3a06f499a251909efba87c7">fabgl::Terminal::loadFont</a></div><div class="ttdeci">void loadFont(FontInfo const *font)</div><div class="ttdoc">Sets the font to use.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l00593">terminal.cpp:593</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7_html_a7c66fc8d559f4956d4ccea196299bca7"><div class="ttname"><a href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">fabgl::Terminal::write</a></div><div class="ttdeci">size_t write(const uint8_t *buffer, size_t size)</div><div class="ttdoc">Sends specified number of codes to the display.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l01632">terminal.cpp:1632</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_aaab5dab5b969a87f538242e524431637_html_aaab5dab5b969a87f538242e524431637"><div class="ttname"><a href="classfabgl_1_1_terminal_aaab5dab5b969a87f538242e524431637.html#aaab5dab5b969a87f538242e524431637">fabgl::Terminal::read</a></div><div class="ttdeci">int read()</div><div class="ttdoc">Reads codes from keyboard.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l01490">terminal.cpp:1490</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_aace245bfe6cab7b4339bd691077e1c23_html_aace245bfe6cab7b4339bd691077e1c23"><div class="ttname"><a href="classfabgl_1_1_terminal_aace245bfe6cab7b4339bd691077e1c23.html#aace245bfe6cab7b4339bd691077e1c23">fabgl::Terminal::enableCursor</a></div><div class="ttdeci">void enableCursor(bool value)</div><div class="ttdoc">Enables or disables cursor.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l00902">terminal.cpp:902</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_ae6f04360ccc33a519bdff509fd81df62_html_ae6f04360ccc33a519bdff509fd81df62"><div class="ttname"><a href="classfabgl_1_1_terminal_ae6f04360ccc33a519bdff509fd81df62.html#ae6f04360ccc33a519bdff509fd81df62">fabgl::Terminal::setBackgroundColor</a></div><div class="ttdeci">void setBackgroundColor(Color color, bool setAsDefault=true)</div><div class="ttdoc">Sets the background color.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l00707">terminal.cpp:707</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_aebaecc1fa474fddc48dd5778024b19a5_html_aebaecc1fa474fddc48dd5778024b19a5"><div class="ttname"><a href="classfabgl_1_1_terminal_aebaecc1fa474fddc48dd5778024b19a5.html#aebaecc1fa474fddc48dd5778024b19a5">fabgl::Terminal::begin</a></div><div class="ttdeci">bool begin(BaseDisplayController *displayController, int maxColumns=-1, int maxRows=-1, Keyboard *keyboard=nullptr)</div><div class="ttdoc">Initializes the terminal.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l00307">terminal.cpp:307</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_af04a513134593e61c4575b266c8bf0ee_html_af04a513134593e61c4575b266c8bf0ee"><div class="ttname"><a href="classfabgl_1_1_terminal_af04a513134593e61c4575b266c8bf0ee.html#af04a513134593e61c4575b266c8bf0ee">fabgl::Terminal::flush</a></div><div class="ttdeci">void flush(bool waitVSync)</div><div class="ttdoc">Waits for all codes sent to the display has been processed.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l00674">terminal.cpp:674</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_afad23f091c4bb07a71963f5f7aa1831d_html_afad23f091c4bb07a71963f5f7aa1831d"><div class="ttname"><a href="classfabgl_1_1_terminal_afad23f091c4bb07a71963f5f7aa1831d.html#afad23f091c4bb07a71963f5f7aa1831d">fabgl::Terminal::setForegroundColor</a></div><div class="ttdeci">void setForegroundColor(Color color, bool setAsDefault=true)</div><div class="ttdoc">Sets the foreground color.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l00727">terminal.cpp:727</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_html"><div class="ttname"><a href="classfabgl_1_1_terminal.html">fabgl::Terminal</a></div><div class="ttdoc">An ANSI-VT100 compatible display terminal.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8h_source.html#l00886">terminal.h:886</a></div></div>
<div class="ttc" id="afabgl_8h_html"><div class="ttname"><a href="fabgl_8h.html">fabgl.h</a></div><div class="ttdoc">This file is the all in one include file. Application can just include this file to use FabGL library...</div></div>
<div class="ttc" id="afabglconf_8h_a48a7b2c95a1f0546c72310844fa6fc74_html_a48a7b2c95a1f0546c72310844fa6fc74"><div class="ttname"><a href="fabglconf_8h_a48a7b2c95a1f0546c72310844fa6fc74.html#a48a7b2c95a1f0546c72310844fa6fc74">OLED_128x64</a></div><div class="ttdeci">#define OLED_128x64</div><div class="ttdef"><b>Definition:</b> <a href="fabglconf_8h_source.html#l00329">fabglconf.h:329</a></div></div>
<div class="ttc" id="agroup___enumerations_ga1e46218ee302fcc8c77e4ea0968ea149_html_gga1e46218ee302fcc8c77e4ea0968ea149afb87bf1fc88386ca21395991f90fff95"><div class="ttname"><a href="group___enumerations_ga1e46218ee302fcc8c77e4ea0968ea149.html#gga1e46218ee302fcc8c77e4ea0968ea149afb87bf1fc88386ca21395991f90fff95">fabgl::VideoMode::I2C</a></div><div class="ttdeci">@ I2C</div></div>
<div class="ttc" id="agroup___enumerations_gaae85628862e3db5a13e7c21a90589c1d_html_ggaae85628862e3db5a13e7c21a90589c1da4059b0251f66a18cb56f544728796875"><div class="ttname"><a href="group___enumerations_gaae85628862e3db5a13e7c21a90589c1d.html#ggaae85628862e3db5a13e7c21a90589c1da4059b0251f66a18cb56f544728796875">fabgl::uiMessageBoxIcon::Info</a></div><div class="ttdeci">@ Info</div></div>
<div class="ttc" id="agroup___enumerations_gab87bacfdad76e61b9412d7124be44c1c_html_ggab87bacfdad76e61b9412d7124be44c1ca8e551a5ca49dca47dd8d5af7a04dd9ea"><div class="ttname"><a href="group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#ggab87bacfdad76e61b9412d7124be44c1ca8e551a5ca49dca47dd8d5af7a04dd9ea">fabgl::BrightGreen</a></div><div class="ttdeci">@ BrightGreen</div><div class="ttdef"><b>Definition:</b> <a href="displaycontroller_8h_source.html#l00213">displaycontroller.h:213</a></div></div>
<div class="ttc" id="agroup___enumerations_gab87bacfdad76e61b9412d7124be44c1c_html_ggab87bacfdad76e61b9412d7124be44c1cac1e9bce8242f443c54c7405223d616cd"><div class="ttname"><a href="group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#ggab87bacfdad76e61b9412d7124be44c1cac1e9bce8242f443c54c7405223d616cd">fabgl::Black</a></div><div class="ttdeci">@ Black</div><div class="ttdef"><b>Definition:</b> <a href="displaycontroller_8h_source.html#l00203">displaycontroller.h:203</a></div></div>
</div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Mon Aug 29 2022 13:52:04 for FabGL by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.3 </li>
  </ul>
</div>
</body>
</html>
